﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Master/AdminDialog.Master" AutoEventWireup="true" CodeBehind="ShowIconDialog.aspx.cs" Inherits="Besture.UI.Admin.Dialog.ShowIconDialog" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
		<!--
        var setting = {
			data: {
				simpleData: {
					enable: true
				}
				
			},
			view: {
		        showLine: false
	        }
			
		};

        var zNodes = <%=_json %>;

        $(document).ready(function () {
            $.fn.zTree.init($("#treeDemo"), setting, zNodes);
        });
		//-->
        
    	var api = frameElement.api, W = api.opener;

    	api.button({
    	    id: 'valueOk',
    	    name: '确定',
    	    callback: ok
    	});
    	
        //选中默认节点
        function DefaultSelectNodes() {
            var icon = "<%= icon %>";
            var treeObj = $.fn.zTree.getZTreeObj("treeDemo");
            var node = treeObj.getNodeByParam("name",icon,null);
            treeObj.selectNode(node);
        }

    	function ok() {
    	   var zTree = $.fn.zTree.getZTreeObj("treeDemo");
 
            var nodes = zTree.getSelectedNodes(true);
            //选中名称
    	    var name = "";
 
            for (var i = 0; i < nodes.length; i++) {
                name = nodes[i].name;
                break;
            }          
    	    W.jQuery(".SelectIconValue").val(name);
    	    W.jQuery(".SelectIconButton").val(name);
    	}

    	$(function() {
    	    DefaultSelectNodes();
    	});
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="content_wrap">
        <div class="zTreeDemoBackground left">
            <ul id="treeDemo" class="ztree">
            </ul>
        </div>
    </div>
    <style type="text/css">
        .ztree li {
            line-height: 35px;
        }
        .ztree li span.button {
            width: 33px;height: 33px;
        }
        .ztree li a {
            height: 35px;
        }
        .ztree li a.curSelectedNode {
            height: 35px;
        }
        .ztree li span {
            line-height: 35px;padding-left: 2px;
        }
    </style>
</asp:Content>
